#ifndef TOOL_H
#define TOOL_H

#define MGID_PATH "./Library/mngid.dat"
#define CSID_PATH "./Library/classid.dat"
#define BKID_PATH "./Library/bookid.dat"
#define USID_PATH "./Library/userid.dat"

#define PROGRESS_NUM_STYLE 0
#define PROGRESS_CHR_STYLE 1
#define PROGRESS_BGC_STYLE 2

#include<sys/types.h>
#include<sys/ioctl.h>
#include<termios.h>
#include <unistd.h>

typedef struct 
{
    char chr;        		/*tip char*/
    const char *title;      /*tip string*/
    int style;        		/*progress style*/
    int max;        		/*maximum value*/
    float offset;
    char *pro;
} progress_t;

//主函数的登录界面
void main_login(void);
//按任意键继续	
void anykey2c(void);
int getch(void);
//初始化id
int init_id(const char* path,int id);
//获得id
int getid(const char* id_path);
//清理输入缓冲区
void clear_stdin(void);
//数据加载
void loading(void);
//登录加载	
void login_loading(void);
//获得时间
int get_days(void);
//退出界面
void quit(void);
//打印等级
void print_star(float praise);
//用于登录加载的初始化　显示　释放指针
extern void progress_init(progress_t *, const char *, int, int);
extern void progress_show(progress_t *, float);
extern void progress_destroy(progress_t *);

#endif